package com.ruoyi.bizsys.service.impl;

import java.util.List;
import java.util.Arrays;
                                                                    import com.ruoyi.common.utils.DateUtils;
            import org.springframework.stereotype.Service;
    import com.ruoyi.bizsys.mapper.CustTransactionSettingMapper;
import com.ruoyi.bizsys.domain.CustTransactionSetting;
import com.ruoyi.bizsys.service.ICustTransactionSettingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;


/**
 * 交易配置信息Service业务层处理
 *
 * @author african-loan
 * @date 2021-10-28
 */
@Service
public class CustTransactionSettingServiceImpl extends ServiceImpl<CustTransactionSettingMapper,CustTransactionSetting> implements ICustTransactionSettingService {

    /**
     * 查询交易配置信息
     *
     * @param id 交易配置信息ID
     * @return 交易配置信息
     */
    @Override
    public CustTransactionSetting selectCustTransactionSettingById(Long id) {
        return this.getById(id);
    }

    /**
     * 查询交易配置信息列表
     *
     * @param custTransactionSetting 交易配置信息
     * @return 交易配置信息
     */
    @Override
    public List<CustTransactionSetting> selectCustTransactionSettingList(CustTransactionSetting custTransactionSetting) {
        return this.list(new QueryWrapper<>(custTransactionSetting).last("order by id desc"));
    }

    /**
     * 新增交易配置信息
     *
     * @param custTransactionSetting 交易配置信息
     * @return 结果
     */
            @Override
    public int insertCustTransactionSetting(CustTransactionSetting custTransactionSetting) {
                                                                                                                    custTransactionSetting.setCreateTime(DateUtils.getNowDate());
                                                return baseMapper.insert(custTransactionSetting);
    }

    /**
     * 修改交易配置信息
     *
     * @param custTransactionSetting 交易配置信息
     * @return 结果
     */
            @Override
    public int updateCustTransactionSetting(CustTransactionSetting custTransactionSetting) {
                                                                                                                                        custTransactionSetting.setUpdateTime(DateUtils.getNowDate());
                            return baseMapper.updateById(custTransactionSetting);
    }

    /**
     * 批量删除交易配置信息
     *
     * @param ids 需要删除的交易配置信息ID
     * @return 结果
     */
            @Override
    public int deleteCustTransactionSettingByIds(Long[] ids) {
        return baseMapper.deleteBatchIds(Arrays.asList(ids));
    }

    /**
     * 删除交易配置信息信息
     *
     * @param id 交易配置信息ID
     * @return 结果
     */
    @Override
    public int deleteCustTransactionSettingById(Long id) {
        return baseMapper.deleteById(id);
    }

}
